import 'package:flutter/material.dart';

import '../../../widgets/circle_cache_image.dart';

class Header extends StatelessWidget {
  const Header({super.key});

  @override
  Widget build(BuildContext context) {
    var isLogin = true;
    // ignore: dead_code
    return isLogin ? _containerLogin(context) : _containerNotLogin(context);
  }

  Container _containerNotLogin(BuildContext context) {
    return Container(
      padding: const EdgeInsets.all(10),
      height: 100,
      decoration: const BoxDecoration(color: Colors.green),
      child: const Row(
        children: [
          CircularCachedNetworkImage(
            url: 'https://q1.qlogo.cn/g?b=qq&nk=1318012531&s=100',
            width: 60,
            height: 60,
            radius: 60,
          ),
          Padding(padding: EdgeInsets.all(10)),
          Expanded(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  "请登录/注册",
                  style: TextStyle(
                      fontSize: 18,
                      color: Colors.black,
                      fontWeight: FontWeight.bold),
                ),
                Padding(padding: EdgeInsets.all(4)),
                Text("还没账号")
              ],
            ),
          )
        ],
      ),
    );
  }

  Container _containerLogin(BuildContext context) {
    return Container(
      padding: const EdgeInsets.all(10),
      height: 100,
      decoration: const BoxDecoration(color: Colors.green),
      child: const Row(
        children: [
          CircularCachedNetworkImage(
            url: 'https://q1.qlogo.cn/g?b=qq&nk=1318012534&s=100',
            width: 60,
            height: 60,
            radius: 30,
          ),
          Padding(padding: EdgeInsets.all(10)),
          Expanded(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  "已登录用户名",
                  style: TextStyle(
                      fontSize: 18,
                      color: Colors.black,
                      fontWeight: FontWeight.bold),
                ),
                Padding(padding: EdgeInsets.all(4)),
                Text("查看编辑个人资料")
              ],
            ),
          )
        ],
      ),
    );
  }
}
